package com.s2sh.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.s2sh.dao.PersonDao;
import com.s2sh.domain.Person;

public class PersonDaoSpringImpl extends HibernateDaoSupport implements PersonDao {

	@Override
	public void savePerson(Person person) {
		this.getHibernateTemplate().save(person) ;
	}

	@Override
	public void updatePerson(Person person) {
		this.getHibernateTemplate().update(person) ;
	}

	@Override
	public void deletePerson(Long id) {
		Person person = (Person)this.getHibernateTemplate().get(Person.class, id) ;
		this.getHibernateTemplate().delete(person) ;
 	}

	@Override
	public List<Person> findAll() {
		List<Person> list = this.getHibernateTemplate().find("from Person") ;
		return list;
	}

	@Override
	public Person findById(Long id) {
		Person person = (Person) this.getHibernateTemplate().get(Person.class, id) ;
		return person;
	}

	@Override
	public void saveBatchPerson(Integer saveNum) {
		System.out.println("暂未实现");
	}

	@Override
	public List<Person> findByPage(Integer firstResult, Integer maxResult) {
		System.out.println("暂未实现");
		return null;
	}
	
	

}
